import {XmlUtil} from "./XmlUtil";
import { NS_STANZAS } from "./JSJaCConstants";

/*exported JSJaCError */

/**
 * an error packet for internal use
 * @private
 * @constructor
 */
export class JSJaCError {
  constructor(code:string,type:string,condition:string){
     let xmldoc = XmlUtil.create("error","jsjac");
     xmldoc.setAttribute('code',code);
     xmldoc.setAttribute('type',type);
     if (condition)
       xmldoc.appendChild(xmldoc.createElement(condition)).
         setAttribute('xmlns', NS_STANZAS);
     return xmldoc;

  }
}
